package com.web.controller;

import com.web.common.Dto.BrandInfoDto;
import com.web.common.responseResult.ResponseResult;
import com.web.common.vo.BrandInfoVo;
import com.web.service.Task3Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * [一句话描述该类的功能]
 *
 * @author : [Lenovo]
 * @version : [v1.0]
 * @createTime : [2024/6/9 下午3:22]
 */
@RestController
@RequestMapping("/task3")
@Slf4j
public class Task3Controller {
    @Autowired
    private Task3Service task3Service;
    @GetMapping("/top10brand")
    public ResponseResult<List<String>> getTop10brand()
    {
        List<String> top10brandNameList = task3Service.getTop10brand();
        return ResponseResult.okResult(top10brandNameList);
    }
    @PostMapping("/saleInfo")
    public ResponseResult<BrandInfoVo> getBrandInfo(@RequestBody  BrandInfoDto brandInfoDto)
    {
        log.info("brandInfoDto:{}",brandInfoDto);
        return task3Service.getBrandInfo(brandInfoDto);
    }
    @GetMapping("/wordCloud")
    public ResponseResult<List<Map<String, Integer>>> getWordCloud(@RequestParam("name") String name)
    {
        log.info("wordCloud:{}",name);
        return task3Service.getWordCloud(name);
    }
}
